﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;

public partial class PMSWeb_DesktopMeet : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string cmdText = string.Format("SELECT top 7 T.*,(select CodeName from T_CodeConfig where Category='" + PMSCodeCategory.PMS_MEETAD + "' and CodeValue=T.MeetAddress) as MeetAddressName FROM {0} T ORDER BY T.MeetTime DESC", "PMS_MEET");
            DataSet ds = PMSAccess.GetDataSet(this.Connection, cmdText);
            StringBuilder sbTemp = new StringBuilder();
            int index = 1;
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                sbTemp.AppendLine("<tr>");
                sbTemp.AppendLine("<td><img src=\"../App_Themes/DefaultSkin/Image/da" + index.ToString() + ".jpg\" alt=\"" + index.ToString() + "\" ></td>");
                sbTemp.AppendLine("<td>" + row["MeetAddressName"].ToString() + "</td>");
                sbTemp.AppendLine("<td><a target='_parent' href='../PMSWeb/MeetManager.aspx?MeetID=" + row["MeetId"].ToString() + "'>" + row["Subject"].ToString() + "</a></td>");
                sbTemp.AppendLine("<td>" + row["PersonCount"].ToString() + "</td>");
                sbTemp.AppendLine("<td>" + Convert.ToDateTime(row["MeetTime"].ToString() + " " + row["StartTime"].ToString()).ToString("MM-dd HH:mm") + "</td>");
                sbTemp.AppendLine("<tr>");
                index++;
            }
            for (int i = index; i < 8; i++)
            {
                sbTemp.AppendLine("<tr>");
                sbTemp.AppendLine("<td>&nbsp;</td>");
                sbTemp.AppendLine("<td>&nbsp;</td>");
                sbTemp.AppendLine("<td>&nbsp;</td>");
                sbTemp.AppendLine("<td>&nbsp;</td>");
                sbTemp.AppendLine("<td>&nbsp;</td>");
                sbTemp.AppendLine("<tr>");
            }

            literal.Text = sbTemp.ToString();
        }
    }
}